package com.ls.shiroWithJwt.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class TestController {

    @RequiresRoles("admin")
    @GetMapping("role1")
    public String testRole1(){
        return "success";
    }

    @RequiresRoles("admin1")
    @GetMapping("role2")
    public String testRole2(){
        return "success";
    }

    @RequiresPermissions("sys:test1")
    @GetMapping("1")
    public String test1(){
        return "success";
    }

    @RequiresPermissions("sys:test2")
    @GetMapping("2")
    public String test2(){
        return "success";
    }

}
